﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using External.APICalling;
using BusinessRule.DTO;
using System.Configuration;
using System.Xml;
using MES.DataGateway.DBUtility;
using System.Data;
using log4net;
using System.Data.OracleClient;
using System.Text;

namespace MESWebService
{
    public class ZDSCSendMESDataMethod
    {        

       
        /// <summary>
        /// 更新作动筒数据 add YangJiang 20180709
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public string  UpdateZDSCData(Dictionary<string, string> para)//STATUS=:STATUS,RESULTNOTE=:RESULTNOTE,MFGWORKDATE=:MFGWORKDATE,
        {
            string strSQL = @"UPDATE mes_senddispatch_table SET PASSQTY=:PASSQTY,
                                LOSSQTY=:LOSSQTY,STARTTIME=:STARTTIME,ENDTIME=:ENDTIME
                                WHERE TASKNO=:TASKNO";
            OracleParameter[] updateParam = new OracleParameter[5];
            //updateParam[0] = NewParameter(":STATUS", para["STATUS"], OracleType.VarChar);
            //updateParam[0] = NewParameter(":RESULTNOTE", para["MESSAGE"], OracleType.VarChar);
            //updateParam[1] = NewParameter(":MFGWORKDATE", para["MFGWORKDATE"], OracleType.VarChar);
            updateParam[0] = NewParameter(":PASSQTY", para["PASSQTY"], OracleType.VarChar);
            updateParam[1] = NewParameter(":LOSSQTY", para["LOSSQTY"], OracleType.VarChar);
            updateParam[2] = NewParameter(":STARTTIME", para["STARTDATE"], OracleType.DateTime);
            updateParam[3] = NewParameter(":ENDTIME", para["ENDDATE"], OracleType.DateTime);
            updateParam[4] = NewParameter(":TASKNO", para["MESNO"], OracleType.VarChar);
            int i = OracleHelper.ExecuteSql(strSQL, updateParam);
            if (i > 0)
            {
                return "更新记录条数:" + i; ;
            }
            else
            {
                return "没有可更新记录";
            }              
        }

       

        /// <summary>
        /// 新建OracleParameter参数 add YangJiang 20180709
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public OracleParameter NewParameter(string strName,object strValue,System .Data .OracleClient .OracleType oracleType)
        {
            OracleParameter Parameter = new OracleParameter(strName, oracleType);
            Parameter.Direction = ParameterDirection.Input;
            Parameter.Value = strValue;
            return Parameter;
        }

    }
}